<?php
/**
 * Interface for form element classes
 *
 * Copyright (C) 2008  Sean Hickey
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @author Sean Hickey <sean@headzoo.com>
 * @version $Id: Interface.php 378 2008-07-03 05:19:31Z sean $
 * @package Alinks_Form
 */
interface Alinks_Form_Element_Interface
{
	/**
	 * Returns the HTML for the form element
	 *
	 * @return string
	 */
	function getHtml();
	
	/**
	 * Sets the name of the element
	 *
	 * @param string $name The element name
	 * @return Alinks_Form_Element_Abstract
	 */
	function setName($name);
	
	/**
	 * Returns the name of the element
	 *
	 * @return string
	 */
	function getName();
	
	/**
	 * Sets the input value
	 *
	 * @param string $value The value
	 * @return Alinks_Form_Element_Abstract
	 */
	function setValue($value);
	
	/**
	 * Returns the input value
	 *
	 * @return string
	 */
	function getValue();
	
	/**
	 * Sets the element arguments
	 *
	 * @param array $args The arguments
	 * @return Alinks_Form_Element_Abstract
	 */
	function setArgs(array $args);
	
	/**
	 * Adds a single element argument
	 *
	 * @param string $key The argument key
	 * @param string $value The argument value
	 * @return Alinks_Form_Element_Abstract
	 */
	function addArg($key, $value);
	
	/**
	 * Returns the set arguments
	 *
	 * @return array
	 */
	function getArgs();
	
	/**
	 * Sets if the form element is required
	 *
	 * @param bool $value Required or not
	 * @return Alinks_Form_Element_Abstract
	 */
	function setRequired($value);
	
	/**
	 * Returns if the form element is required
	 *
	 * @return bool
	 */
	function isRequired();
	
	/**
	 * Sets a regular expression that the value must match to be valid
	 *
	 * @param string $match The must match regexp
	 * @return Alinks_Form_Element_Abstract
	 */
	function setMustMatch($match);
	
	/**
	 * Returns the the must match regular expression
	 *
	 * @return string
	 */
	function getMustMatch();
	
	/**
	 * Sets a regular expression that the value must not match to be valid
	 *
	 * @param string $match The not match regexp
	 * @return Alinks_Form_Element_Abstract
	 */
	function setNotMatch($match);
	
	/**
	 * Returns the not match regular expression
	 *
	 * @return string
	 */
	public function getNotMatch();
	
	/**
	 * Returns if the set form values are valid
	 *
	 * @return bool
	 */
	function isValid();
	
	/**
	 * Returns any invalid messages
	 *
	 * @return array
	 */
	function getMessages();
	
	/**
	 * Returns the HTML for the form element
	 *
	 * @return string
	 */
	function __toString();
}